package com.muchfish.reactor.api;

import reactor.core.publisher.Flux;
import reactor.core.scheduler.Schedulers;

public class ReactorSubscribeOnExample {
    public static void main(String[] args) throws InterruptedException {
        Flux<Integer> source = Flux.range(1, 3).log();

        // 将数据流的订阅线程切换到另一个线程池
        source.subscribeOn(Schedulers.parallel())
                .map(value -> value * 2)
                .subscribe(System.out::println);

        Thread.sleep(23333);
    }
}
